<?php 
class Application_Model_User extends Application_Model_Resource_User_Row 
{
    private $_accounts;
    
    /**
     * 获取 User 资源对象
     *
     * @return Application_Model_Resource_User_Table
     */
    public static function getResource() 
    {
        return Application_Model_Resource_FinderFactory::getFinder(
            Application_Model_Resource_FinderFactory::USER_FINDER );
    }
    
    public function getAccounts()
    {
        if ($this->_accounts === null) {
            $this->_accounts = Application_Model_Account::getResource()->findByUser($this->id);
        }
        return $this->_accounts;
    }
}